import socket                                         

serversocket = socket.socket(
	        socket.AF_INET, socket.SOCK_STREAM) 
#host = socket.gethostname() #本机地址                          
host='172.16.39.86';
port = 8087                                           
serversocket.bind((host, port))
serversocket.listen(5)                                           
print("我在 ", host, " 等你...")
clientsocket,addr = serversocket.accept()   

#print("来自 %s" % str(addr))
msg='你好！'+ "\r\n"
clientsocket.send(msg.encode('gb2312'))

msg=clientsocket.recv(1024)
print("来自 %s" % str(addr),':',msg.decode('gb2312'))

clientsocket.close()